//go:build linux
// +build linux

package main

import (
	"time"

	//_ "net/http/pprof"
	"game_process_monitor/jobs"
	"game_process_monitor/services"
	"game_process_monitor/util"
	_ "game_process_monitor/util"

	"github.com/go-kit/kit/log/level"
	"github.com/patrickmn/go-cache"
	"github.com/robfig/cron"
	"github.com/zeromicro/go-zero/core/service"
)

var (
	psCron *cron.Cron
)

func init() {
	jobs.GoCache = cache.New(5*time.Minute, 60*time.Second)
	psCron = cron.New()
}

func main() {
	err := psCron.AddFunc("0 */1 * * * * ", jobs.PsCronFunc)
	if err != nil {
		level.Error(util.Logger).Log("cron eror", err)
	}
	psCron.Start()
	defer psCron.Stop()
	// http services
	serviceGroup := service.NewServiceGroup()
	defer serviceGroup.Stop()
	serviceGroup.Add(&services.ProcessStatus{})
	serviceGroup.Start()
}
